
/* 

	Motion controllers for a stepper controller.

	Used to controll controllers like the GeckoDriver (http://www.geckodrive.com/)
 
 */

#include <StepperController.h>


long timestep = 100; 
long timenow = 0; 
long timewas = 0; 
long timeprn = 1000; 



// initialize the stepper controller library (Steps Per Revolution, Puls Pin Used, Direction Pin Used).

StepperController StepXaxis(200, 8,9);            
StepperController StepYaxis(200, 10,11);            
StepperController StepZaxis(200, 12,13);            

void setup()
	{
	// initialize the serial port:
	Serial.begin(9600);

	StepXaxis.offset(0);
	StepYaxis.offset(0);
	StepXaxis.offset(0);
	};

void loop()
	{
	unsigned long timenow = millis();
 
	if(timenow - timewas > timestep)
		{
		timewas = timenow

		StepXaxis.step(1);
		StepYaxis.step(1);
		StepXaxis.step(1);

		};
	
	if(timenow - timeprn > 5000)
		{
		timeprn = timenow;
		Serial.println("Location: X: " + StepXaxis.location() + " Y: " + StepYaxis.location()+ " Z: " + StepZaxis.location() + " NOW: " + timenow);
		};

	};


